<table class="table">
  <tr>
    <th class="text-left gray-font-12">标题</th>
    <th class="text-right gray-font-12">文章数</th>
    <th class="text-right gray-font-12">发布时间</th>
  </tr>
  <%- if topics.size > 0 %>
      <%- topics.each do |topic| %>
          <tr>
            <th class="text-left font14"><%= link_to topic.title, topic_path(topic) %></th>
            <th class="text-right gray-font-12"><%= topic.articles.size %></th>
            <th class="text-right gray-font-12">
              <%- _current_year = Time.new.strftime("%Y") %>
              <%- _topic_year = topic.created_at.strftime("%Y") %>
              <%- if _current_year == _topic_year %>
                  <%= topic.created_at.strftime("%m-%d %H:%M") %>
              <% else %>
                  <%= topic.created_at.strftime("%y-%m-%d") %>
              <% end %>
            </th>
          </tr>
      <%- end %>
  <%- else %>
      <tr>
        <th class="text-left font14"></th>
        <th class="text-center gray-font-12">
          没有可显示内容,<%= link_to '点击添加', new_topic_path, 'data-no-turbolink' => true %>
        <th class="text-right gray-font-12"></th>
      </tr>
  <%- end %>
</table>
<%= render partial: 'common/paginate', locals: {obj: topics} %>